package com.dxc.intern.entity;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;



@Getter
@Setter
@NoArgsConstructor
public class Page<T> {

    /**
     * 总条数
     */
    private int total;
    /**
     * 分了几页
     */
    private int pages;
    /**
     * 当前第几页
     */
    private int current;
    private List<T> list = new ArrayList<>();

    public Page(int limit, int current, int total, List<T> list) {
        this.current = current;
        this.total = total;
        this.pages = total % limit == 0 ? total / limit : total / limit + 1;
        this.list = list;
    }

}
